package com.example.easyexcel.entity.write;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Builder;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

@Getter
@Setter
@Builder
public class UserInfo {

    // 以下三个属性字段是 Excel 表格的头部标题，index 属性是设置列的顺序
    @ExcelProperty(value = "字符串标题", index = 0)
    private String string;
    @ExcelProperty(value = "日期标题", index = 1)
    private Date date;
    /**
     * 这里设置3 会导致第二列空的
     */
    @ExcelProperty(value = "数字标题", index = 3)
    private Double doubleData;


    //
    @ExcelProperty("用户编号")
    private Long userId;

    @ExcelProperty("用户名称")
    private String username;

    @ExcelProperty("用户密码")
    private String password;

    @ExcelProperty("用户密码")
    private Boolean gender;

    @ExcelProperty("创建时间")
    @JsonFormat
    private Date createTime;

    @ExcelProperty("更新时间")
    @JsonFormat
    private Date updateTime;

    @ExcelProperty("创建者")
    private String createBy;

    @ExcelProperty("更新者")
    private String updateBy;

    /**
     * 忽略这个字段
     */
    @ExcelIgnore
    private String ignore;

}

// 关于 easyexcel 的使用，可以参考： https://easyexcel.opensource.alibaba.com/docs/current/quickstart/write